import request from '@/utils/request'

// 查询菜单列表
export function listMenu(query) {
  return request({
    url: '/system/sysMenu/list',
    method: 'post',
    params: query
  })
}

// 查询菜单详细
export function getMenu(menuId) {
  const data = {
    menuId
  }
  return request({
    url: '/system/sysMenu/getUserMenu',
    method: 'get',
    params: data
  })
}

// 查询菜单下拉树结构
export function roleTreeSelect() {
  return request({
    url: '/system/sysMenu/treeSelect',
    method: 'post'
  })
}

// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(roleId) {
  return request({
    url: '/system/sysMenu/roleMenu',
    method: 'get'
  })
}

// 新增菜单
export function addMenu(data) {
  return request({
    url: '/system/sysMenu/save',
    method: 'post',
    params: data
  })
}

// 修改菜单
export function updateMenu(data) {
  debugger;
  return request({
    url: '/system/sysMenu/update',
    method: 'post',
    params: data
  })
}

// 删除菜单
export function delMenu(menuId) {
 const data = {
   menuId
 }
  return request({
    url: '/system/sysMenu/delete',
    method: 'post',
    params: data
  })
}
